<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        img {
            vertical-align: top;
        }

        ul {
            list-style: none;
        }

        #wrapper {
            height: 390px;
            width: 640px;
            margin: 50px auto;
            position: relative;
        }

        .img-list {
            height: 390px;
        }

        .img-list li {
            position: absolute;
            opacity: 0;
            transition: opacity 1s;
        }

        .img-list .current {
            z-index: 1;
            opacity: 1;
        }

        .prev-next a {
            font-size: 60px;
            color: white;
            font-weight: bold;
            text-decoration: none;
            position: absolute;
            height: 60px;
            z-index: 2;
            top: 0;
            bottom: 0;
            margin: auto;
            opacity: .5;


        }

        .prev-next a:hover {
            opacity: 1;
        }

        #next {
            right: 0;
        }
    </style>

</head>

<body>
    <div id="wrapper">
        <ul class="img-list">
            <li class="current">
                <a href="javascript:;">
                    <img src="./轮播图/images/1.png" alt="">
                </a>
            </li>

            <li>
                <a href="javascript:;">
                    <img src="./轮播图/images/2.png" alt="">
                </a>
            </li>
            <li>
                <a href="javascript:;">
                    <img src="./轮播图/images/3.png" alt="">
                </a>
            </li>
            <li>
                <a href="javascript:;">
                    <img src="./轮播图/images/4.png" alt="">
                </a>
            </li>
            <li>
                <a href="javascript:;">
                    <img src="./轮播图/images/5.png" alt="">
                </a>
            </li>
        </ul>

        <div class="prev-next">
            <a id="prev" href="javascript:;"><</a>
            <a id="next" href="javascript:;">></a>
        </div>
    </div>

    <script>
        setTimeout(function auto() {
            const current = document.querySelector(".img-list .current")

            const next = current.nextElementSibling || document.querySelector(".img-list li:first-child")

            current.classList.remove("current")
            next.classList.add("current")

            setTimeout(auto, 3000)
        }, 3000)

        const prev = document.getElementById("prev")
        const next = document.getElementById("next")

        prev.onclick = () => {
            const current = document.querySelector(".img-list .current")

            const next = current.previousElementSibling || document.querySelector(".img-list li:last-child")

            current.classList.remove("current")
            next.classList.add("current")
        }

        next.onclick = () => {
            const current = document.querySelector(".img-list .current")

            const next = current.nextElementSibling || document.querySelector(".img-list li:first-child")

            current.classList.remove("current")
            next.classList.add("current")
        }
    </script>
</body>

</html>